package com.qf.cx.simplenms.persist.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "ReaderGroup")
public class ReaderGroupEntity {
	@Id
	@Column(name = "name")
	private String name;
	@ManyToMany(targetEntity = AntennaEntity.class, fetch = FetchType.EAGER)
	@JoinTable(name = "ReaderGroup_Antenna", joinColumns = @JoinColumn(name = "readerGroupName"), inverseJoinColumns = @JoinColumn(name = "antennaId"))
	private List<AntennaEntity> antennaEntities;

	@ManyToMany(targetEntity = TopicEntity.class, fetch = FetchType.LAZY)
	@JoinTable(name = "Topic_ReaderGroup", joinColumns = @JoinColumn(name = "readerGroupName"), inverseJoinColumns = @JoinColumn(name = "topicName"))
	private List<TopicEntity> topicEntities;

	public List<AntennaEntity> getAntennaEntities() {
		return antennaEntities;
	}

	public void setAntennaEntities(List<AntennaEntity> antennaEntities) {
		this.antennaEntities = antennaEntities;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
